<%@page import="cn.gcxy.entity.CarPage"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="config.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
	<link href="${ctx}/css/car.css" rel="stylesheet"/>
	<script type="text/javascript" src="${ctx}/js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="js/car.js"></script>
</head>
<body>
<div class="handler4">	
		<span>购物车管理</span>
		<table class="myTable" id="${carPages[0].uid}">
			<tr class="tr1">
				<td class="td1"><span>商品缩略图</span></td>
				<td class="td1"><span>商品名称</span></td>
				<td class="td1"><span>商品单价</span></td>
				<td class="td1"><span>商品数量</span></td>
				<td class="td1"><span>商品小计</span></td>
				<td class="td1"><span>操作</span></td>
			</tr>
			<!-- 分别是总个数，总价格   -->
<%-- 			<c:set var="countSum" property="0"></c:set>
			<c:set var="priceSum" property="0"></c:set> --%>
			<c:forEach items="${carPages}" var="carPage">
				<tr id="${carPage.id}" class="trNode">
<%--  					<td hidden="true">
					${countSum = countSum + carPage.num}
					${priceSum = priceSum + carPage.commodity.price * carPage.num}
					</td>  --%>
					<td class="td1"><img alt="" src="${carPage.commodity.imgpath}" /></td>
					<td class="td1"><span>${carPage.commodity.name}</td>
					<td class="td1"><span id="price" class="price">${carPage.commodity.price}</span></td>
					<td class="td1" id="count"><input class="count" type="number" min="0" value="${carPage.num}"></td>
					<td class="td1"><span class="total">${carPage.commodity.price * carPage.num}</span></td>
					<td class="td1"><button class="delete">删除</button><button disabled="disabled">修改</button> </td>
				</tr>
			</c:forEach>
		</table>
		
		<table class="myTable2">
			<tr>
				<td>
					商品种类数：<span id="classSum">${carPages.size()}</span>｜
					商品总个数：<span id="countSum"><%=CarPage.getCount()%></span>｜
					商品总价：<span id="priceSum"><%=CarPage.getTotle()%></span>｜
					<button type="reset" id="clearCar">清除购物车</button>
					<button id="continueShop">继续购买</button>
					<button id="buy">结算中心</button></td>
			</tr>
		</table>
	</div>
</body>
</html>